package singleton.lazy.insecurity;

public class Singleton {

    private static Singleton instance;

    private Singleton() {

    }

    /**
     * 提供一个静态的静态方法，当用到这个方法时才创建instance
     * @return
     */
    public static synchronized Singleton getInstance() {
        if (instance == null) { //还未创建的话才创建该实例
            instance = new Singleton();
        }
        return instance;
    }
}
